<template>
  <div>
    <!-- <div style="display: none;">{$random_content}</div> -->
    <div class="mainmodule">
    	<div class="mainlist">
        <ul v-if="isExistArray('3',gysInfo.system_function_model)">
          <li v-if="gysInfo.supplier_flag && gysInfo.showSupplierOrder">
            <div @click="Jump('listsGys')" class="icon_gysdd">
              供货订单
              <i class="icon-right"></i>
            </div>
          </li>
          <li v-if="gysInfo.supplier_flag && gysInfo.showSupplierItem">
            <div @click="Jump('supplierItems')" class="icon_gyssp">
              供货商品
              <i class="icon-right"></i>
            </div>
          </li>
          <li v-if="gysInfo.supplier_flag && gysInfo.showSupplierWithdraw">
            <div @click="Jump('supplierWithdraw')" class="icon_gystx">
              供货收入
              <i class="icon-right"></i>
            </div>
          </li>
          <li v-if="gysInfo.is_tgy && gysInfo.showPromoterOrder">
            <div @click="Jump('tgyorder')" class="icon_yscsp">
              招商经理订单
              <i class="icon-right"></i>
            </div>
          </li>
          <li v-if="gysInfo.is_tgy && gysInfo.showRecommendedSupplier">
            <div @click="Jump('tgyRecommendGys')" class="icon_tjgys">
              推荐供应商
              <i class="icon-right"></i>
            </div>
          </li>
          <li v-if="gysInfo.common_center_renovation_parameter.showShareLinkGys">
            <div @click="Jump('/shareSelect')" class="icon20_1_fx">
              万能链接
              <i class="icon-right"></i>
            </div>
          </li>
          <!-- 视频号数据 -->
          <li v-if="gysInfo.show_video_num_data_gys">
            <div @click="Jump('venderOrder', {type: 'live'})"
                 class="icon_sphsj">视频号数据
              <span></span>
              <svg-icon icon-class="icon_right"
                        class="icon_right"></svg-icon>
            </div>
          </li>
        </ul>
        <!-- 自定义项 -->
        <ul v-if="gysInfo.dataset_gys && gysInfo.dataset_gys.length>0">
          <li v-for="(item,index) in gysInfo.dataset_gys"
              :key="index">
            <a @click="JumpUrl(item.link)"
              class="custom_item"
              :style="{backgroundImage: 'url('+item.pic+')'}">
              {{item.showtitle}}
              <svg-icon icon-class="icon_right"
                        class="icon_right"></svg-icon>
            </a>
          </li>
        </ul>
      </div>
    </div>
  </div>
</template>

<script>
import Vue from 'vue'
import { openPage } from '@/utils/utils.js'

export default Vue.extend({
  props: {
    gysInfo: {
      type: Object
    }
  },
  methods: {
    // 判断数组是否存在某值
    isExistArray(val, array) {
      if (!array) return false
      const ret = array.indexOf(val)
      if (ret == -1) {
        return false
      } else {
        return true
      }
    },
    Jump(url, data) {
      this.$JumpPath(this, url, data)
    },
    JumpUrl(url) {
      openPage(url)
    },
    _show_qrcode() {
      this.$emit('showQrcode')
    }
  }
})
</script>

<style lang="scss">
@import 'src/styles/user/index.scss';
</style>